/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ez2find.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

/**
 *
 * @author Administrador
 */
@NamedQueries(value={@NamedQuery(name="listAllSites", query="SELECT s FROM Site s ORDER BY s.site" ),  
                     @NamedQuery(name="sitesCountry", query="SELECT s FROM Site s WHERE s.country=:country ORDER BY s.site")})
                     
@Entity
public class Site implements Serializable{

    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE)
    private Long id;
    private String site;
    private String description;
    @OneToMany(mappedBy="site",cascade={CascadeType.PERSIST, CascadeType.REMOVE})
    private List<Area> areas;
    @ManyToOne()
    private Country country;
    @OneToMany(mappedBy="site",cascade=CascadeType.REMOVE)
    private List<Post> posts;
    @OneToMany(mappedBy="defaultSite")
    private List<RegisterUser> users;
    private double jobPrice;
    @OneToMany(mappedBy="site",cascade=CascadeType.REMOVE)
    private List<HousPrice> housPrices;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<Area> getAreas() {
        return areas;
    }

    public void setAreas(List<Area> areas) {
        this.areas = areas;
    }

    public Country getCountry() {
        return country;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    public List<RegisterUser> getUsers() {
        return users;
    }

    public void setUsers(List<RegisterUser> users) {
        this.users = users;
    }

    public List<Post> getPosts() {
        return posts;
    }

    public void setPosts(List<Post> posts) {
        this.posts = posts;
    }

    public double getJobPrice() {
        return jobPrice;
    }

    public void setJobPrice(double jobPrice) {
        this.jobPrice = jobPrice;
    }

    public List<HousPrice> getHousPrices() {
        return housPrices;
    }

    public void setHousPrices(List<HousPrice> housPrices) {
        this.housPrices = housPrices;
    }
    
}
